Skip to main content

Full text of "Arduino"

See other formats

PIR Sensor Arduino Alarm 


Make Projects 

build, hack, tweak, share, discover. 

PIR Sensor Arduino Alarm 

Written By: John Edgar Park 



Computer running Arduino IDE software 

USB cable. Standard A to B. 6ft (1) 
from RadioShack. 

Arduino Uno microcontroller. Rev. 3 (1) 
from RadioShack. 

Solderless breadboard, modular (1) 
from RadioShack. 

Parallax PIR sensor (1) 
from RadioShack. 

Solderless Breadboard Jumper Wire Kit 

from RadioShack. 

Piezo buzzer. 1.500Hz-3.000Hz (1) 
from RadioShack. 

LED. 5mm. red (1) 
from RadioShack. 


In this simple project, we'll build a motion-sensing alarm using a PIR (passive infrared) 
sensor and an Arduino microcontroller. This is a great way to learn the basics of using digital 
input (from the sensor) and output (in this case, to a noisy buzzer) on your Arduino. 

© Make Projects 

Page 1 of 6 

PIR Sensor Arduino Alarm 

This alarm is handy for booby traps and practical jokes, and it's just what you'll need to 
detect a zombie invasion! Plus, it's all built on a breadboard, so no soldering required! 

Step 1 — Gather your parts. 

• This project requires just a few 
parts, and because you're using a 
solderless breadboard and pre-cut 
jumper wires, you won't need any 
tools at all — except your 
computer and USB cable to 
connect the Arduino. 

Step 2 — Wire the Arduino to the breadboard. 

• Connect digital input/output (I/O) 
pin 2 on the Arduino to row 1 on the 

• Connect the 5V pin on the Arduino 
to row 2 on the breadboard, and 
connect a nearby ground (Gnd) pin 
to row 3. 

© Make Projects 

Page 2 of 6 

PIR Sensor Arduino Alarm 

Step 3 — Connect your motion sensor. 

• Find the Gnd (-), Vcc (+), and Out pins on the PIR sensor. 

• Plug the PIR sensor into the breadboard so that its (-) pin connects to the Gnd row, its (+) 
pin connects to 5V, and its Out pin connects to digital pin 2. 

• NOTE: If you have a different sensor than the one shown here, you may need to 
extend the sensor's pins with a stacking female header, wires, interconnect cables, 
etc. to fit. 

Step 4 — Plug in the LED. 

• Plug the LED's anode (the longer leg) into digital pin 13 on the Arduino. 

• Plug the LED's cathode (the shorter leg, and/or the leg on the flattened side of the LED 
base) into the adjacent ground (Gnd) pin on the Arduino. 

© Make Projects 

Page 3 of 6 

PIR Sensor Arduino Alarm 

Step 5 — Connect the piezo buzzer. 

• Connect the buzzer's red wire to the Arduino's digital pin 10. 

• Connect the buzzer's black wire to the Arduino's Gnd pin (there's a spare one on the 
Power block of pins). 

• NOTE: These two wires can be reversed, as the polarity of the buzzer doesn't 


© Make Projects 

Page 4 of 6 

PIR Sensor Arduino Alarm 

Step 6 — Program the Arduino. 

JepFWjMjrrn I 0018- 

[qigi apminr- m 



■ PIB »r,ur liil.r 1-, Llatr P.ied .1 fWai^.L 

■ol ]*flPln a 13- 
r.l. JfWUPIn - I] 
-i. pll4UU • Ldl'l 
r,l vol ■ Bj 
ft* »irt(.»l.r - l»; 

111 MMMlIM 9, 1". 

• r ||) 

raid MMpO [ 

pirfladftt ItdPI », DOtPUl): // dot lore IEQ it bKtpu 
Pi^no0n{lnpwrini, iwvrl; /,■' 4icL»r« wok* „, in 
ipinSpmkw, OJIHjris 


wo! ■ dlgliDLItoa4(l4HtFln)| .v nroc inpji ■r-siue- 
■ (nl - HICK) ( // cn«t 

j.q.i oiiiriMtfoPifl. Wi6*>: // lurni led oh 

slayTgnv^ai, t«4) ; 

j'/ plOLiToiisim i>i): 
}} d«Uu(l»)j 


1 (plnSloli " LW] 1 

E.r.|al.pi-iMLr.(T4Ua* d.-.I:-*d ! ") | 
// II. tnly MM L* sriiil An Iht MlStf etlOn«*. nu 
olrSHulo - HUGH; 


1 •■-■ { 

H, 5 ii a |Uri-.i£6,fl»ie P UUJ); // furr. LED WF 
pleuTonBiS, (■>; 
. .;;■■ : 
1 (eli^KHI ■" HICHll 

• Launch the Arduino IDE software. You can download it for free here . 

• Plug the USB cable into your computer and Arduino. 

• Set the board and port settings for your Arduino board, in this case, an Arduino Uno. 

• Open the PIR Alarm sketch. (Arduino programs are called sketches.) You can download it 
for free here . 

• Upload the sketch to the Arduino. 

© Make Projects 

Page 5 of 6 

PIR Sensor Arduino Alarm 

Step 7 — Test your alarm. 

• When you power up your alarm, the PIR sensor will glow an ominous red. Stand very still 
or leave the room while the alarm calibrates the infrared level reading for the room. 

• Now test it by moving: the buzzer will buzz and the LED will light up. 

• Be amazed! Your PIR Sensor Arduino Alarm can sense movement up to 20 feet away. No 
one will be stealing your yo-yo today. 

• NOTE: Might not be reliable for detecting the undead. 

This document was last generated on 2012-11-20 06:26:46 AM. 

© Make Projects 

Page 6 of 6